// 在你的业务逻辑中使用
use crate::database::{MySqlDatabase, DbError};

// 假设你已经初始化了连接池
async fn example_usage(db: &MySqlDatabase) -> Result<(), DbError> {
    // 查询示例
    #[derive(serde::Deserialize)]
    struct User {
        id: u32,
        user_name: String

    }

    let users: Vec<User> = db.query(
        "SELECT id, name FROM users WHERE age > ?",
        vec![mysql_async::Value::Int(18)]
    ).await?;

    // 插入示例
    let user_id = db.insert(
        "INSERT INTO users (name, age) VALUES (?, ?)",
        vec![
            mysql_async::Value::from("张三"),
            mysql_async::Value::Int(25)
        ]
    ).await?;

    println!("新用户ID: {}", user_id);

    Ok(())
}
